package com.corona.game;

import com.badlogic.gdx.graphics.g2d.Sprite;
import com.badlogic.gdx.math.Vector2;
import com.corona.Game;

import java.util.ArrayList;

/* compiled from: Battle.java */
/* loaded from: pokewilds.jar:com/pkmngen/game/FriendlyFaint.class */
class FriendlyFaint extends Action {
    ArrayList<Integer> repeats;
    ArrayList<Boolean> playSound;
    Vector2 move;
    Sprite sprite;
    public Action.Layer layer = Action.Layer.gui_120;
    boolean firstStep = true;
    Vector2 position = null;
    ArrayList<Vector2> positions = new ArrayList<>();

    public FriendlyFaint(Game game, Action nextAction) {
        super(new Object[0]);
        this.nextAction = nextAction;
        for (int i = 0; i < 7; i++) {
            this.positions.add(new Vector2(0.0f, -8.0f));
        }
        this.positions.add(new Vector2(0.0f, 0.0f));
        this.positions.add(new Vector2(0.0f, 0.0f));
        this.repeats = new ArrayList<>();
        this.repeats.add(24);
        for (int i2 = 0; i2 < 8; i2++) {
            this.repeats.add(2);
        }
        this.playSound = new ArrayList<>();
        this.playSound.add(true);
        for (int i3 = 0; i3 < 15; i3++) {
            this.playSound.add(false);
        }
        this.sprite = new Sprite((Sprite) game.player.currPokemon.backSprite);
    }

    @Override // com.corona.game.Action
    public String getCamera() {
        return "gui";
    }

    @Override // com.corona.game.Action
    public Action.Layer getLayer() {
        return this.layer;
    }

    @Override // com.corona.game.Action
    public void step(Game game) {
        if (this.firstStep) {
            game.actionStack.remove(game.battle.drawAction.drawFriendlyHealthAction);
            game.battle.drawAction.drawFriendlyHealthAction = null;
            game.actionStack.remove(game.battle.drawAction.drawFriendlyPokemonAction);
            game.battle.drawAction.drawFriendlyPokemonAction = null;
            game.player.currPokemon.status = null;
            game.player.currPokemon.statusCounter = 0;
            game.player.currPokemon.volatileStatus.clear();
            game.player.currPokemon.volatileStatusCounter.clear();
            this.firstStep = false;
        }
        if (this.positions.isEmpty() || this.repeats.isEmpty()) {
            game.actionStack.remove(this);
            return;
        }
        this.sprite.draw(game.uiBatch);
        if (this.repeats.get(0).intValue() > 1) {
            this.repeats.set(0, Integer.valueOf(this.repeats.get(0).intValue() - 1));
            return;
        }
        this.sprite.setRegionHeight(this.sprite.getRegionHeight() + (((int) this.positions.get(0).y) / 2));
        this.sprite.setSize(this.sprite.getWidth(), this.sprite.getHeight() + ((float) (((int) this.positions.get(0).y) / 2)));
        if (this.playSound.get(0).booleanValue()) {
            game.insertAction(new PlaySound(game.player.currPokemon, new WaitFrames(game, game.player.currPokemon.specie.cryLengthInFrames(), this.nextAction)));
        }
        this.positions.remove(0);
        this.repeats.remove(0);
        this.playSound.remove(0);
    }
}
